package com.food.chronicles.user.vo;

import com.food.chronicles.user.entity.Recipe;
import lombok.Data;

import java.util.Date;

@Data
public class RecipeVo {

    private Long id;

    private String title;

    private Integer userId;

    private String userNme;

    private String coverImage;

    private Integer likeCount;

    private Integer collectCount;

    private Integer commentCount;

    private Integer isFeatured;

    private Date createTime;

    public static RecipeVo convertToRecipeVo(Recipe recipe) {
        RecipeVo recipeVo = new RecipeVo();
        recipeVo.setId(recipe.getId());
        recipeVo.setTitle(recipe.getTitle());
        recipeVo.setCoverImage(recipe.getCoverImage());
        recipeVo.setLikeCount(recipe.getLikeCount());
        recipeVo.setCollectCount(recipe.getCollectCount());
        recipeVo.setCommentCount(recipe.getCommentCount());
        recipeVo.setIsFeatured(recipe.getIsFeatured());
        recipeVo.setCreateTime(recipe.getCreateTime());
        return recipeVo;
    }
}
